package com.jiazhong.shixi.controller;

import com.jiazhong.shixi.bean.Bingli;
import com.jiazhong.shixi.mapper.BingliMapper;
import com.jiazhong.shixi.util.JsonResult;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@CrossOrigin("*")
@RestController
@RequestMapping("/bingl")
public class BingliController {
    @Resource
    private BingliMapper bingliMapper;

    @RequestMapping("/add")
    public JsonResult tianjia(Bingli bingli) {
        System.out.println(bingli);
        Bingli b = bingliMapper.add(bingli);
        JsonResult result = new JsonResult(true,200,"scuccess","");
        return result;
    }

    @RequestMapping("/mohu")
    public JsonResult mohu(String bingliZhengzhuang) {
        List list = bingliMapper.mohu("%" + bingliZhengzhuang + "%");
        JsonResult result = new JsonResult(true,200,list,"");
        return result;

    }

    @RequestMapping("/zuixin")
    public JsonResult zuixin(){
        System.out.println(111);
        List list = bingliMapper.zuixin();
        System.out.println(list);
        JsonResult result = new JsonResult(true,200,list,"");
        return result;
    }
}
